Dynamic Text

Description

You can update the data in a ControlBar dynamically and animated the ControlBar when it is refreshed.

Text entered into a textbox control updating a ControlBar html item .
Text entered into a textbox control updating a ControlBar html item .

To see an example on how to add dynamic text to a ControlBar watch this video.

Create a Button that Updates ControlBar Text Using an Action

  1. In the UX Builder open the Controls page check the Mobile checkbox.

    Ctcon
  2. Open the Panel menu on the left and select the [Panel Card] option to add a Panel Card to the component.

    Ctcon2
  3. Highlight the Panel Card. Open the Containers menu and select the [Container] option.

    Ctcon3
  4. Select 'PanelHeader' from the Container Type list and click 'Insert After'.

    Ctcon4
  5. Highlight the Panel Header. Open the Other Controls menu and click [ControlBar] to add a ControlBar inside the Panel Header.

    Ctcon5
  6. Highlight the ControlBar. In the properties list on the right click on the 'ControlBar properties' property to open the ControlBar Builder.

    Ctcon6
  7. On the ControlBar Builder's 'Data' pane click the Add Data Item button.

    Ctcon7
  8. Give the data item a Setting name of 'appName' and a value of 'My First Application'. Click OK

    Ctcon8
  9. Open the 'Items' pane and click the Add ControlBar Item button.

    Ctcon9
  10. Select 'html' from the Item Type radio buttons and click OK.

    Ctcon10
  11. Click the button next to the HTML text item property. This is in the ControlBar Item Properties list under HTML Settings.

    Ctcon11
  12. Double click on {appName} to add it to the editor and click OK. The HTML text property should now read {appName}.

    Ctcon12
  13. Open the ControlBar Layout pane. Click the Add Layout button. Give the layout the name 'Layout1' and click OK.

    Ctcon13
  14. Click the 'Add Line' button

    Ctcon14
  15. Hit the 'Add' button under the 'Middle' section in the Edit Layout Line dialog. Select the HTml1 item that you defined on the Items pane. Click OK and OK again to close the ControlBar Builder.

    Ctcon15
  16. On the Controls page highlight the [PanelHeader End:PANELHEADER_1] tag. Open the 'Other Controls' menu and select [Button] to add a button underneath the Panel Header.

    Ctcon16
  17. Double click on the button control to open the Edit Click Event dialog.

    Ctcon17
  18. Choose the 'Action Javascript' setting and click the 'Add New Action' button.

    Ctcon18
  19. Type 'bar' into the Filter list and then in the 'Actions' list select the 'ControlBar Actions' option and click OK.

    Ctcon19
  20. In the List Control Actions dialog click the button next to the 'Action name' property and select Update ControlBar Data from the list.

    Ctcon20
  21. Set the 'ControlBar Id' property to be 'CONTROLBAR_1'.

    Ctcon21
  22. Click the button next to the Data variables to update property. Select 'appName' from the list and click OK.

    Ctcon22
  23. Click the button next to the 'Data variable values' property. Assign appName a new value and click OK. The value should look something like this:

    appName = 'My Second App'
    Ctcon23
  24. Save the new action.

    Ctcon24
  25. Highlight the button control. In the Button Properties section of the properties list change the 'Button text' property to read 'Change text'

    Ctcon25
  26. Run the Component in Live Preview.

    Ctcon26
  27. When you click the Change Text button you should see the ControlBar change as well.

    Ctcon27

Add Dynamic Text to the ControlBar

This guide continues to modify the component built in the section above.

  1. Highlight the button control. Open the 'Data Controls' menu and click on [TextBox] option to add a textbox control to the component. Give the textbox control the name 'txt1'.

    Dt
  2. Double click on the button control to open the 'Edit Click Event' dialog.

    Dt2
  3. Highlight the ControlBar Actions action that you defined in section 1 and click the 'Edit Action' button.

    Dt3
  4. Click the button next to the Data variable values property. Change the value of the appName variable to be the following and click OK, OK, and Save:

    appName = {dialog.object}.getValue('txt1')
    Dt4
    DON'T add a ';' at the end of this statement.
  5. Run the component in Live Preview. Type something into the textbox control.

    Dt5
  6. Hit the 'Change text' button. The ControlBar should update to reflect the textbox control's text.

    Dt6